package com.koron.sinoprobe.web.ledger.bean.convertor;

import com.koron.sinoprobe.web.ledger.bean.vo.SpProjectVO;
import com.koron.sinoprobe.web.plan.bean.entity.SpAssistDept;
import com.koron.sinoprobe.web.plan.bean.entity.SpMember;
import com.koron.sinoprobe.web.plan.bean.entity.SpPlanMilestone;
import com.koron.sinoprobe.web.plan.bean.vo.SpPlanMilestoneVO;
import com.koron.sinoprobe.web.plan.bean.vo.SpPlanVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author twcao
 * @title: PlanConvertor
 * @projectName GDH_EAM_V2
 * @description: 专项计划实体转换
 * @date 2021/12/114:16
 */
@Mapper(componentModel = "spring")
public interface PlanConvertor {

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(source = "id", target = "planId"),
            @Mapping(source = "status", target = "status", ignore = true),
            @Mapping(source = "code", target = "code", ignore = true),
            @Mapping(source = "createTime", target = "createTime", ignore = true),
            @Mapping(source = "updateTime", target = "updateTime", ignore = true)
    })
    SpProjectVO plaVOnToProjectVO(SpPlanVO planVO);

    @Mappings({
            @Mapping(source = "id", target = "id", ignore = true),
            @Mapping(source = "spId", target = "spId", ignore = true),
            @Mapping(source = "createTime", target = "createTime", ignore = true)
    })
    SpAssistDept assistDept(SpAssistDept dept);

    List<SpAssistDept> assistDepts(List<SpAssistDept> depts);

    @Mappings({
            @Mapping(source = "id", target = "id", ignore = true),
            @Mapping(source = "spId", target = "spId", ignore = true),
            @Mapping(source = "createTime", target = "createTime", ignore = true)
    })
    SpMember member(SpMember spMember);

    List<SpMember> members(List<SpMember> members);

    @Mappings({
            @Mapping(source = "id", target = "id", ignore = true),
            @Mapping(source = "spId", target = "spId", ignore = true),
            @Mapping(source = "createTime", target = "createTime", ignore = true)
    })
    SpPlanMilestone milestone(SpPlanMilestone milestone);

    List<SpPlanMilestone> milestones(List<SpPlanMilestone> milestones);

    SpPlanMilestone milestoneVOTOBean(SpPlanMilestoneVO milestones);

    List<SpPlanMilestone> milestonesVOTOBeans(List<SpPlanMilestoneVO> milestones);
}
